\title{Contributing}

\subsection{Contributing}

Interested in contributing to Edward? We appreciate all kinds of help!

\subsubsection{Pull requests}

We gladly welcome pull requests.

Before making any changes, we recommend opening an issue (if it
doesn't already exist) and discussing your proposed changes. This will
let us give you advice on the proposed changes. If the changes are
minor, then feel free to make them without discussion.

Want to contribute but not sure what to contribute? Here are a few
suggestions:
\begin{enumerate}
\item
Add a new example.  They are located in the
\href{https://github.com/blei-lab/edward/tree/master/examples}
{\texttt{examples/}} directory on Github.
They are the easiest to contribute to and
can get you acquainted with Edward's developer process.
\item
Add a new tutorial. They are written as Jupyter notebooks and located
in the
\href{https://github.com/blei-lab/edward/tree/master/notebooks}
{\texttt{notebooks/}} directory on Github.
The goal is that all examples eventually become a tutorial---so you
can port over an existing example.
Each has a corresponding LaTeX document in the
\href{https://github.com/blei-lab/edward/tree/master/docs/tex}
{\texttt{docs/tex/}} directory.
Write either the \texttt{ipynb} or \texttt{tex} version, and we can
help you reformat to produce the other.
\item
Add a new algorithm (or improve existing algorithms).
They are located in the
\href{https://github.com/blei-lab/edward/tree/master/edward/inferences}
{\texttt{edward/inferences/}} directory on Github.
\item
Solve
\href{https://github.com/blei-lab/edward/issues}{existing issues}
in Edward. They range from low-level software bugs to higher-level
design problems. Check out the label
"\href{https://github.com/blei-lab/edward/issues?q=is\%3Aissue+is\%3Aopen+label\%3A\%22Good+first+contribution\%22}
{Good first contribution}".
\end{enumerate}

To make changes,
\href{https://help.github.com/articles/working-with-forks/}{fork the repo}.
Write code in this fork with the following guidelines.

\textbf{Style guide.}
Follow
\href{https://www.tensorflow.org/community/style_guide}{TensorFlow's
style guide}
for writing code.
Follow
\href{https://www.tensorflow.org/community/documentation}{TensorFlow's documentation guide}
for writing documentation.

\textbf{Unit testing.}
Unit testing is awesome. It's useful not only
for checking code after having written it, but also in checking code
as you are developing it.
Most pull requests require unit tests.
Follow
\href{https://www.tensorflow.org/api_guides/python/test}
{TensorFlow's testing guide}.
To run the unit tests, we use
\href{http://doc.pytest.org/}{pytest}:
run \texttt{pytest tests/} in command line.
To run specific unit tests, call \texttt{pytest} individually, e.g.,
\texttt{pytest tests/test\_metrics.py}.

Submit the pull request whenever you're ready. You can also submit an
incomplete pull request to get intermediate feedback.

\subsubsection{Suggested developer workflow}\label{suggested-workflow}

If you're developing in Edward,
we recommend downloading and installing Edward locally. This enables
any local changes you make to Edward to appear any time you
import Edward in a Python session. To install locally, run the
following:

\begin{lstlisting}[language=JSON]
git clone git@github.com:blei-lab/edward.git  # use your fork's url
pip install -e edward
\end{lstlisting}

We recommend not installing with \texttt{sudo} but with
\texttt{virtualenv}. In fact, we recommend
\texttt{virtualenvwrapper}, which is a light wrapper on top of
\texttt{virtualenv}.
\href{http://docs.python-guide.org/en/latest/starting/install/osx/}
{Here is a guide on how to set it up}.

All code should be compatible with both Python 2 and 3.
\texttt{virtualenvwrapper} makes it easy to develop in both Python versions
and let them manage their own packages.
If you set up \texttt{virtualenvwrapper} from the above guide,
\href{http://www.marinamele.com/2014/07/install-python3-on-mac-os-x-and-use-virtualenv-and-virtualenvwrapper.html}
{here is a guide on how to setup a virtualenv with Python 3}.
Now we need only work on the corresponding virtualenv to ensure Python
2 and 3 compatibility.
